<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>录音播放</title>
</head>
<body>
<p style="font-size: large">录音播放控件：</p>
			 <object id="ctrl" classid="clsid:1CBEB3C0-5783-4546-B0DD-0AFFCFE3954E">
			</object>
            <br />
        <p>
             &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<input id="btnInit" type="button" value="播放" onClick="Play()" />
              &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
            <input id="btnLogin" type="button" value="停止播放" onClick="StopPlay()" /> </p>
</body>

<script th:inline="javascript" type="text/javascript" language='javascript'>

   function getQueryString(name) { 
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r != null) return unescape(r[2]); return null; 
	} 


    function Play()
    {	
    	var serviceUrl = "http://10.190.202.207/CTIService/";
    	var agentId=getQueryString("agentId");
    	var callId=getQueryString("callId");
    	var fileName=getQueryString("fileName");
        var serviceUrl = "http://10.190.202.207/CTIService/";
     var agentId = [[${param.agentId}]];
	 alert(agentId);
     var callId = [[${param.callId}]];
		alert(callId);
 	 var fileName = [[${param.fileName}]];
 		alert(fileName);
         try
         {
         	alert(ctrl);
             ctrl.WebServiceUrl = serviceUrl;
             ctrl.PlayRecord(agentId, callId, fileName);
         }
         catch (e)
         {
             alert(e.message);
         } 

     }
	   
	   function StopPlay()
	   {
		   try
		   {
			ctrl.StopPlay();
		   }
		   catch(e)
		   {
			alert(e.message);
		   }
	   }

   </script>
</html>